
package me.zhengjie.base;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
* @website https://el-admin.vip
* @description /
* @author IQW
* @date 2022-07-18
**/
@Data
public class TreeNodes implements Serializable {

    /** ID */
    private Integer id;

    private Integer parentId;
    /** 表示层级 */
    @JSONField(name = "type")
    private Integer level;
    /** 名称 */
    private String label;

    private String img;

    private Boolean disabled = false;

    private List<TreeNodes> children;

    public TreeNodes() {
    }

    public TreeNodes(Integer id, Integer level, String label) {
        this.id = id;
        this.level = level;
        this.label = label;
    }

    public TreeNodes(Integer id, Integer parentId, Integer level, String label) {
        this.id = id;
        this.parentId = parentId;
        this.level = level;
        this.label = label;
    }

    public TreeNodes(Integer id, Integer parentId, Integer level, String label,Boolean disabled) {
        this.id = id;
        this.parentId = parentId;
        this.level = level;
        this.label = label;
        this.disabled = disabled;
    }

    public TreeNodes(Integer id, Integer parentId, Integer level, String label,String type,String img) {
        this.id = id;
        this.parentId = parentId;
        this.level = level;
        this.label = label;
        this.img = img;
        if(type.equals("5")){
            this.label += "(护林员)";
        }else{
            this.label += "(林长)";
        }
    }
}